
/**
 *
 * @functionNameRules
 * 平台名称+接口名称+Api
 * eg: redirectTo函数 : wx(平台名称)+redirectTo(接口名称)+Api = wxRedirectToApi
 *
 **/
 

 "use strict"


/**
 *
 * @Describe redirectTo接口
 * @Effect 关闭当前页面，跳转到应用内的某个页面。但是不允许跳转到 tabbar 页面
 * @Author zpw
 * @Param url 
 * @Create-time 2019/09/05
 * @Update-time 2019/09/11
 * @Literature  https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.redirectTo.html
 *
 **/

export const wxRedirectToApi = (url) => {
    wx.miniProgram.redirectTo({
        url: url,
        success: function(res){
            console.log('success')
        },
        fail: function(error){
            console.log('fail');
        },
        complete:function(){
            console.log('complete');
        }
    })
}

/**
 *
 * @Describe navigateTo接口
 * @Effect 保留当前页面，跳转到应用内的某个页面。但是不能跳到 tabbar 页面。使用 wx.navigateBack 可以返回到原页面。小程序中页面栈最多十层
 * @Author zpw
 * @Param url 
 * @Create-time 2019/09/05
 * @Update-time 2019/09/11
 * @Literature  https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.navigateTo.html
 *
 **/

export const wxNavigateToApi = (url) => {
    wx.miniProgram.navigateTo({
        url: url,
        success: function(){
            console.log('success')
        },
        fail: function(){
            console.log('fail');
        },
        complete:function(){
            console.log('complete');
        }
    })
}

/**
 *
 * @Describe 
 * @Effect 
 * @Author zpw
 * @Param null
 * @Create-time 2019/09/11
 * @Update-time 2019/09/11
 * @Literature  
 *
 **/
export const wxCardPackageApi = (url) => {
    console.log("唤起卡包");
}


/**
 *
 * @Describe 当前文档基本信息
 * @Author zpw
 * @Param null
 * @Create-time 2019/09/05
 * @Update-time 2019/09/11
 * @Literature  null
 *
 **/

 export const wxDocumentInfomationApi = (url) => {
    return {
      "name" : "wx-api",
      "author" : "张盼伟",
      "phone" : "15600117320",
      "email" : "15600117320@163.com",
      "describe" : "通过传参方式回调小程序原生api供h5调用"
    }
 }

export default {
  wxRedirectToApi,
  wxNavigateToApi,
  wxCardPackageApi,
  wxDocumentInfomationApi
}

